<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div class="app">
        <p>cont 的值是：{{cont}}</p>
        <!-- vue 的内置变量 $event 它就是原生DOm 的事件对象 -->
        <button @click="add(3,$event)">+N</button>
    </div>
    <script>
        const vm = new Vue({
            el: '.app',
            data:{
                cont: 1,
            },
            methods: {
                add(n,e){
                    this.cont += n
                    if(this.cont % 2 == 0){
                        console.log(e)
                        e.target.style.backgroundColor = 'red'
                    }else{
                        console.log(e)
                        e.target.style.backgroundColor = 'aqua'
                    }
                },
            }
        })
    </script>
</body>
</html>